<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Title</title>
</head>
<link href="../static/css/bootstrap.min.css" rel="stylesheet"/>
<link href="../static/css/bootstrap-combined.min.css" rel="stylesheet"/>

<script src="../static/js/jquery-3.2.0.min.js"></script>
<script src="../static/js/bootstrapValidator.js"></script>
<script src="../static/js/bootstrap.min.js"></script>
<link href="../static/FileUploadQT/css/iconfont.css" rel="stylesheet" type="text/css"/>
<link href="../static/FileUploadQT/css/fileUpload.css" rel="stylesheet" type="text/css">
<script src="../static/js/AjaxModel.js"></script>
<script src="../static/js/Excomm.js"></script>

<body>
<div th:include="header::header"></div>

<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="row-fluid">
                <div class="span3">
                </div>
                <div class="span6">
                    <table class="table">
                        <thead>
                        <tr>
                            <th>
                                电话
                            </th>
                            <th>
                                型号
                            </th>
                            <th>
                                描述
                            </th>
                            <th>
                                期望售卖价格
                            </th>
                            <th>
                                创建日期
                            </th>
                            <th>
                                是否处理
                            </th>
                        </tr>
                        </thead>
                        <tbody id="capplieOrderInfo">
                        <tr class="info">
                            <td th:text="${content.phone}">

                            </td>
                            <td th:text="${content.carXinghao}">

                            </td>
                            <td th:text="${content.carDescrip}">

                            </td>
                            <td th:text="${content.wantPrice}">

                            </td>
                            <td id="createTime">

                            </td>
                            <td id="isSale">

                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <fieldset>
                        <legend>更新订单状态</legend>
                        <form action="/masters/applie_order_update" method="post">
                            申请编号：<input id="nowApplieOrderId" name="nowApplieOrderId" type="text" th:value="${content.id}"/>
                        <select name="category" id="statu">
                            <option value="0">未处理</option>
                            <option value="1">正在处理</option>
                            <option value="2">已经处理</option>
                        </select>
                            <button type="submit">确认修改状态</button>
                        </form>

                    </fieldset>


                    <fieldset>
                        <legend>上传汽车的相关文件</legend>
                    </fieldset>
                    <form id="form" action="/masters/upfiles" method="post" enctype="multipart/form-data">
                        <div  id="fileUploadContent" class="fileUploadContent">
                        </div>
                    </form>

                    <form action="/masters/transaction_create_after" method="post">
                        <fieldset>
                            <legend>创建交易表单</legend>
                            申请编号：<input name="applieOrderId" type="text" th:value="${content.id}"/>
                            输入卖家的账号【电话】:<input  name="saleUserPhone" type="number" maxlength="11" minlength="11"/>
                            输入买家的账号【电话】:<input name="buyUserPhone" type="number" maxlength="11" minlength="11"/>
                            <button type="submit">增加交易</button>
                        </fieldset>
                    </form>
                </div>
                <div class="span3">
                </div>
            </div>
        </div>
    </div>
</div>
<script th:inline="javascript">
    $(function () {


        var s=[[${content}]];
        var status=s.isOver;
        var resultStatus;
        if(status==0){
            resultStatus="未处理";
        }else if (status==1){
            resultStatus="正在处理";
        }else if(status==2){
            resultStatus="已经处理";
        }
        $("#isSale").append(resultStatus);
        $("#createTime").append(Excomm.transDate(s.createTime));
        $("#statu option").each(function(){ //遍历全部option
            var txt = $(this).val(); //获取option的内容
            if(txt==status){
                this.selected=true;
            }
        });
        $("#statu2 option").each(function(){ //遍历全部option
            var txt = $(this).val(); //获取option的内容
            if(txt==status){
                this.selected=true;
            }
        });
        /*]]>*/
    })

</script>
</body>

</html>
<script type="text/javascript" src="../static/FileUploadQT/js/fileUpload.js"></script>
<script type="text/javascript">
    $("#fileUploadContent").initUpload({
        "uploadUrl":"/masters/upfiles?applieOrderId="+$("#nowApplieOrderId").val(),//上传文件信息地址
//        "progressUrl":"#",//获取进度信息地址，可选，注意需要返回的data格式如下（{bytesRead: 102516060, contentLength: 102516060, items: 1, percent: 100, startTime: 1489223136317, useTime: 2767}）
//        "showSummerProgress":true,//总进度条，默认限制
        //"size":350,//文件大小限制，单位kb,默认不限制
        //"maxFileNumber":3,//文件个数限制，为整数
        //"filelSavePath":"",//文件上传地址，后台设置的根目录
        //"beforeUpload":function(){alert("zxm first");},//在上传前执行的函数
        "onUpload":function(){alert("文件上传成功！");},//在上传后执行的函数
        "fileType":['xls','jpg']//文件类型限制，默认不限制，注意写的是文件后缀
    })
</script>